package com.heima.freemarkerDemo.controller;

import com.heima.freemarkerDemo.pojos.Student;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.*;

@Controller
public class DemoController {
    @GetMapping("/demo")
    public String demo(Model model)
    {
        Student stu=new Student();
        stu.setName("kzj");
        stu.setAge(18);
        model.addAttribute("stu",stu);
        Student stu1=new Student();
        stu1.setName("小红");
        stu1.setAge(19);
        Student stu2=new Student();
        stu2.setName("小飞");
        stu2.setAge(155);
        Student stu3=new Student();
        stu3.setName("小名");
        stu3.setAge(35);
        Student stu4=new Student();
        stu4.setName("小登录");
        stu4.setAge(348908089);
        List<Student> list=new ArrayList<>();
        list.add(stu1);
        list.add(stu2);
        list.add(stu3);
        list.add(stu4);
        Map<String, Object> map=new HashMap<>();
        map.put("stu1",stu1);
        map.put("stu2",stu2);
        map.put("stu3",stu3);
        map.put("stu4",stu4);
        model.addAttribute("map",map);
        model.addAttribute("stus",list);
        model.addAttribute("today",new Date());
        return "test";
    }


}
